package com.example.bootdemo.common.exception;

import com.example.bootdemo.common.enums.ResultCodeEnum;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

/**
 * 参数全局异常类
 */
@Getter
@Setter
public class ParameterException extends RuntimeException {

    private ResultCodeEnum resultCodeEnum;

    public ParameterException(String msg) {
        super(msg);
        ResultCodeEnum parameterError = ResultCodeEnum.PARAMETER_ERROR;
        if (StringUtils.isNotBlank(msg)){
            parameterError.setMessage(msg);
        }
        this.resultCodeEnum = parameterError;
    }

}